<?php
include_once('../includes/utilidades.php');
require_once('../includes/seguridad.php');
require_once('../includes/html.php');
session_start();
$rolesConAcceso = array('club','admin');
if (!rolOK($_SESSION['roles'],$rolesConAcceso))
        exit;
//print_r($tablas);
/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

 //conectaDb();
 print "<h1>Temporadas</h1>";
 $temporada = select("select id as idtemporada,nombre,fechainicio,fechafin from temporada");
 $actual = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
 
 $t=new HTML_Tabla($temporada);
 $t->setDisplayColumnNames(array('nombre'=>'Temporada','fechainicio'=>'Desde','fechafin'=>'Hasta'));
 $t->setEnlaces('idtemporada', array('Ver Club'=>'club.php'));
 $t->toHTML();
 $t->printHTML();
 
 /*
 print("<table border=1>");
 if (count($temporada) > 0) {
        foreach ($temporada[0] as $columna => $valor) {
            print "<th>" . $columna . "</th>";
        }
        print "<th colspan=3></th>";
        print "</tr>";

        foreach ($temporada as $fila) {
            $uid = null;
            foreach ($fila as $columna => $valor) {
                if ($columna == 'id') {
                    $uid = $valor;
                }
                print "<td>" . $valor . "</td>";
            }
            print "<td><a href=club.php?idtemporada=" . "$uid" . ">Ver</a> </td>";
            print "</tr>";
        }

        print "</table>";
    } else {
        print "No hay registros";
    }
   */
 
    if (isUserInRol($_SESSION['username'],"admin")) {
                print "<a href=copiarAtletas.php?idtemporada=2&idtemporadaanterior=1>copiar atletas temporada anterior</a>";
            }
    
?>

